# !/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName : zsj.py
# @Time     : 2024/4/9 19:22
# @Author   : Robot-Zsj
"""
description:

input
30 12 25 8 19

output
15

"""

import math

bricks = list(map(int, input().split()))


def check(energy, limit):
    cost = 0
    for brick in bricks:
        cost += math.ceil(brick / energy)
        if cost > limit:
            return False

    return True


def getResult():
    if len(bricks) > 8:
        return -1

    maxEnergy = max(bricks)

    if len(bricks) == 8:
        return maxEnergy

    ans = maxEnergy

    minEnergy = 1

    while minEnergy <= maxEnergy:
        mid = (minEnergy + maxEnergy) >> 1

        if check(mid, 8):
            ans = mid
            maxEnergy = mid - 1
        else:
            minEnergy = mid + 1
    return ans


print(getResult())
